package com.dodayum.dubbo;

import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.registry.NotifyListener;
import com.alibaba.dubbo.registry.RegistryService;

import java.util.List;

/**
 * 注册实例，具体可以定制化
 * @Author DoDayum
 * @Date 2024-01-10-20:50
 */
public class MyDubboRegistryService implements RegistryService {

    // 注册
    @Override
    public void register(URL url) {
        System.out.println("注册");
        System.out.println("host:\t" + url.getHost());
        System.out.println("path:\t" + url.getPath());
    }

    // 取消注册
    @Override
    public void unregister(URL url) {
        System.out.println("取消注册");
        System.out.println("host:\t" + url.getHost());
        System.out.println("path:\t" + url.getPath());
    }

    // 订阅
    @Override
    public void subscribe(URL url, NotifyListener notifyListener) {
        System.out.println("订阅");
        System.out.println("host:\t" + url.getHost());
        System.out.println("path:\t" + url.getPath());
    }

    // 取消订阅
    @Override
    public void unsubscribe(URL url, NotifyListener notifyListener) {
        System.out.println("取消订阅");
        System.out.println("host:\t" + url.getHost());
        System.out.println("path:\t" + url.getPath());
    }


    @Override
    public List<URL> lookup(URL url) {
        System.out.println("查看所有");
        return null;
    }
}
